#!/bin/bash
# @file: 
#	prepare.sh
# @desc:
#	
# @Author:
#	codergege
# @Last Update:
#	2016-11-21 
# @usage:
#	sh prepare.sh

# path
home=/home/codergege
pwdDir=$pwd
libdir=$home/workspace/open-source
codergegeLib=$libdir/codergege-lib-1.0.jar
mysqlDriver=$libdir/mysql-connector-java-5.1.6.jar
oracleDriver=$libdir/ojdbc6.jar

# 删除无用的文件
filelist=`ls -a .`
for file in $filelist
do 
 if [ $file == "." ] || [ $file == ".." ] || [ $file == "web-init.sh" ] || [ $file == "emp-crud-demo.md" ] || [ $file == "src" ] || [ $file == "build.gradle" ] || [ $file == "prepare.sh" ]; then
	 echo "$file"
 else
	 rm -rf $file
 fi
done

# 将 build.gradle 备份
mv build.gradle build.gradle.bak

# 执行 gralde init
gradle init

# 删除 build.gradle, 换回原来的
rm -rf build.gradle
mv build.gradle.bak build.gradle

# copy jar 包
mkdir -p lib/autogen

cp -a $codergegeLib lib/
cp -a $mysqlDriver lib/autogen
cp -a $oracleDriver lib/autogen

# 生成 src/test
mkdir -p src/test/java/cn/codergege
mkdir -p src/test/resources

